package job.work.domain.resquest;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

import javax.validation.constraints.Min;
import java.io.Serializable;


@AllArgsConstructor
@NoArgsConstructor
//接收 参数
@Api(tags = "分页参数")
public class PageRequest implements Serializable {

    /**
     * 分页参数 第几页
     */
    @Min(value = 1)
    @ApiModelProperty(value = "分页参数 第几页",example = "1",required = true)
    private Integer pageNumber;

    /**
     * 分页参数 每页显示的条数
     */
    @Min(value = 1)
    @ApiModelProperty(value = "分页参数 每页显示的条数",example = "10",required = true)
    private Integer pageSize;

    public Integer getPageNumber() {
        if (pageNumber ==null || pageNumber<1){
            pageNumber = 1;
        }
        return pageNumber;
    }

    public void setPageNumber(Integer pageNumber) {
        this.pageNumber = pageNumber;
    }

    public Integer getPageSize() {
        if (pageSize ==null || pageSize<1){
            pageSize = 10;
        }
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }
}
